package com.edgclub.edg.utils.util;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

/**
 * 欢迎页的存储
 * 
 *
 */
public class CommAppPrefUtils {

	private static final String WELPREF = "gz_wel_pref";

	private Context context;

	private SharedPreferences sharedPreferences;

	private Editor editor;

	public CommAppPrefUtils(Context context) {
		this.context = context;

		sharedPreferences = context.getSharedPreferences(WELPREF,
				Context.MODE_APPEND);

		editor = sharedPreferences.edit();

	}

	public void save(String url) {
		editor.putString("url", url);
		editor.commit();
	}

	public String get() {
		return sharedPreferences.getString("url", "");
	}

	public void clear() {
		save("");
	}
	public void saveLinkUrl(String linkUrl) {
		editor.putString("linkurl", linkUrl);
		editor.commit();
	}

	public String getLinkUrl() {
		return sharedPreferences.getString("linkurl", "");
	}
	/**
	 * 保存提示的状态
	 */
	public void saveGuide() {
		editor.putBoolean("guide", false);
		editor.commit();

	}

	/**
	 * 是否需要进行提示
	 *
	 * @return
	 */
	public boolean isGuide() {
		return sharedPreferences.getBoolean("guide", true);

	}

	/**
	 * 保存下次再说更新提示的时间
	 */
	public void saveNextUpdateTime(long time) {
		editor.putLong("updatetime", time);
		editor.commit();

	}

	/**
	 * 获取下次再说更新提示的时间
	 *
	 * @return
	 */
	public long getNextUpdateTime() {
		return sharedPreferences.getLong("updatetime", 0L);

	}

	/**
	 * 保存下载状态
	 */
	public void saveDown(Boolean down) {
		editor.putBoolean("down", down);
		editor.commit();

	}

	/**
	 * 是否已经下载
	 *
	 * @return
	 */
	public boolean isDown() {
		return sharedPreferences.getBoolean("down", false);

	}
}
